<!doctype html>
<script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script>
<script src="../../assert_selection.js"></script>
<script>
selection_test(
  '<div contenteditable dir="rtl">|\n Just\n <span>testing what</span>\n ever\n</div>',
  selection => selection.modify('extend', 'left', 'character'),
  '<div contenteditable dir="rtl">\n ^J|ust\n <span>testing what</span>\n ever\n</div>',
  '15-0 rtl left character');

selection_test(
  '<div contenteditable dir="rtl">\n| Just\n <span>testing what</span>\n ever\n</div>',
  selection => selection.modify('extend', 'left', 'character'),
  '<div contenteditable dir="rtl">\n ^J|ust\n <span>testing what</span>\n ever\n</div>',
  '15-1 rtl left character');

selection_test(
  '<div contenteditable dir="rtl">\n |Just\n <span>testing what</span>\n ever\n</div>',
  selection => selection.modify('extend', 'left', 'character'),
  '<div contenteditable dir="rtl">\n ^J|ust\n <span>testing what</span>\n ever\n</div>',
  '15-2 rtl left character');

selection_test(
  '<div contenteditable dir="rtl">\n J|ust\n <span>testing what</span>\n ever\n</div>',
  selection => selection.modify('extend', 'left', 'character'),
  '<div contenteditable dir="rtl">\n J^u|st\n <span>testing what</span>\n ever\n</div>',
  '15-3 rtl left character');

selection_test(
  '<div contenteditable dir="rtl">\n Ju|st\n <span>testing what</span>\n ever\n</div>',
  selection => selection.modify('extend', 'left', 'character'),
  '<div contenteditable dir="rtl">\n Ju^s|t\n <span>testing what</span>\n ever\n</div>',
  '15-4 rtl left character');

selection_test(
  '<div contenteditable dir="rtl">\n Jus|t\n <span>testing what</span>\n ever\n</div>',
  selection => selection.modify('extend', 'left', 'character'),
  '<div contenteditable dir="rtl">\n Jus^t|\n <span>testing what</span>\n ever\n</div>',
  '15-5 rtl left character');

selection_test(
  '<div contenteditable dir="rtl">\n Just|\n <span>testing what</span>\n ever\n</div>',
  selection => selection.modify('extend', 'left', 'character'),
  '<div contenteditable dir="rtl">\n Just^\n| <span>testing what</span>\n ever\n</div>',
  '15-6 rtl left character');

selection_test(
  '<div contenteditable dir="rtl">\n Just\n| <span>testing what</span>\n ever\n</div>',
  selection => selection.modify('extend', 'left', 'character'),
  '<div contenteditable dir="rtl">\n Just\n <span>^t|esting what</span>\n ever\n</div>',
  '15-7 rtl left character');

selection_test(
  '<div contenteditable dir="rtl">\n Just\n <span>|testing what</span>\n ever\n</div>',
  selection => selection.modify('extend', 'left', 'character'),
  '<div contenteditable dir="rtl">\n Just\n <span>^t|esting what</span>\n ever\n</div>',
  '15-8 rtl left character');

selection_test(
  '<div contenteditable dir="rtl">\n Just\n <span>t|esting what</span>\n ever\n</div>',
  selection => selection.modify('extend', 'left', 'character'),
  '<div contenteditable dir="rtl">\n Just\n <span>t^e|sting what</span>\n ever\n</div>',
  '15-9 rtl left character');

selection_test(
  '<div contenteditable dir="rtl">\n Just\n <span>te|sting what</span>\n ever\n</div>',
  selection => selection.modify('extend', 'left', 'character'),
  '<div contenteditable dir="rtl">\n Just\n <span>te^s|ting what</span>\n ever\n</div>',
  '15-10 rtl left character');

selection_test(
  '<div contenteditable dir="rtl">\n Just\n <span>tes|ting what</span>\n ever\n</div>',
  selection => selection.modify('extend', 'left', 'character'),
  '<div contenteditable dir="rtl">\n Just\n <span>tes^t|ing what</span>\n ever\n</div>',
  '15-11 rtl left character');

selection_test(
  '<div contenteditable dir="rtl">\n Just\n <span>test|ing what</span>\n ever\n</div>',
  selection => selection.modify('extend', 'left', 'character'),
  '<div contenteditable dir="rtl">\n Just\n <span>test^i|ng what</span>\n ever\n</div>',
  '15-12 rtl left character');

selection_test(
  '<div contenteditable dir="rtl">\n Just\n <span>testi|ng what</span>\n ever\n</div>',
  selection => selection.modify('extend', 'left', 'character'),
  '<div contenteditable dir="rtl">\n Just\n <span>testi^n|g what</span>\n ever\n</div>',
  '15-13 rtl left character');

selection_test(
  '<div contenteditable dir="rtl">\n Just\n <span>testin|g what</span>\n ever\n</div>',
  selection => selection.modify('extend', 'left', 'character'),
  '<div contenteditable dir="rtl">\n Just\n <span>testin^g| what</span>\n ever\n</div>',
  '15-14 rtl left character');

selection_test(
  '<div contenteditable dir="rtl">\n Just\n <span>testing| what</span>\n ever\n</div>',
  selection => selection.modify('extend', 'left', 'character'),
  '<div contenteditable dir="rtl">\n Just\n <span>testing^ |what</span>\n ever\n</div>',
  '15-15 rtl left character');

selection_test(
  '<div contenteditable dir="rtl">\n Just\n <span>testing |what</span>\n ever\n</div>',
  selection => selection.modify('extend', 'left', 'character'),
  '<div contenteditable dir="rtl">\n Just\n <span>testing ^w|hat</span>\n ever\n</div>',
  '15-16 rtl left character');

selection_test(
  '<div contenteditable dir="rtl">\n Just\n <span>testing w|hat</span>\n ever\n</div>',
  selection => selection.modify('extend', 'left', 'character'),
  '<div contenteditable dir="rtl">\n Just\n <span>testing w^h|at</span>\n ever\n</div>',
  '15-17 rtl left character');

selection_test(
  '<div contenteditable dir="rtl">\n Just\n <span>testing wh|at</span>\n ever\n</div>',
  selection => selection.modify('extend', 'left', 'character'),
  '<div contenteditable dir="rtl">\n Just\n <span>testing wh^a|t</span>\n ever\n</div>',
  '15-18 rtl left character');

selection_test(
  '<div contenteditable dir="rtl">\n Just\n <span>testing wha|t</span>\n ever\n</div>',
  selection => selection.modify('extend', 'left', 'character'),
  '<div contenteditable dir="rtl">\n Just\n <span>testing wha^t|</span>\n ever\n</div>',
  '15-19 rtl left character');

selection_test(
  '<div contenteditable dir="rtl">\n Just\n <span>testing what</span>|\n ever\n</div>',
  selection => selection.modify('extend', 'left', 'character'),
  '<div contenteditable dir="rtl">\n Just\n <span>testing what</span>^\n| ever\n</div>',
  '15-20 rtl left character');

selection_test(
  '<div contenteditable dir="rtl">\n Just\n <span>testing what</span>\n| ever\n</div>',
  selection => selection.modify('extend', 'left', 'character'),
  '<div contenteditable dir="rtl">\n Just\n <span>testing what</span>\n ^e|ver\n</div>',
  '15-21 rtl left character');

selection_test(
  '<div contenteditable dir="rtl">\n Just\n <span>testing what</span>\n |ever\n</div>',
  selection => selection.modify('extend', 'left', 'character'),
  '<div contenteditable dir="rtl">\n Just\n <span>testing what</span>\n ^e|ver\n</div>',
  '15-22 rtl left character');

selection_test(
  '<div contenteditable dir="rtl">\n Just\n <span>testing what</span>\n e|ver\n</div>',
  selection => selection.modify('extend', 'left', 'character'),
  '<div contenteditable dir="rtl">\n Just\n <span>testing what</span>\n e^v|er\n</div>',
  '15-23 rtl left character');

selection_test(
  '<div contenteditable dir="rtl">\n Just\n <span>testing what</span>\n ev|er\n</div>',
  selection => selection.modify('extend', 'left', 'character'),
  '<div contenteditable dir="rtl">\n Just\n <span>testing what</span>\n ev^e|r\n</div>',
  '15-24 rtl left character');

selection_test(
  '<div contenteditable dir="rtl">\n Just\n <span>testing what</span>\n eve|r\n</div>',
  selection => selection.modify('extend', 'left', 'character'),
  '<div contenteditable dir="rtl">\n Just\n <span>testing what</span>\n eve^r|\n</div>',
  '15-25 rtl left character');

selection_test(
  '<div contenteditable dir="rtl">\n Just\n <span>testing what</span>\n ever|\n</div>',
  selection => selection.modify('extend', 'left', 'character'),
  '<div contenteditable dir="rtl">\n Just\n <span>testing what</span>\n ever|\n</div>',
  '15-26 rtl left character');

selection_test(
  '<div contenteditable dir="rtl">\n Just\n <span>testing what</span>\n ever\n|</div>',
  selection => selection.modify('extend', 'left', 'character'),
  '<div contenteditable dir="rtl">\n Just\n <span>testing what</span>\n ever\n|</div>',
  '15-27 rtl left character');
</script>
